package com.cloud.shopping.seckill.controller;

import com.cloud.shopping.seckill.model.SeckillActivity;
import com.cloud.shopping.seckill.service.SeckillActivityService;
import com.cloud.shopping.tool.RespResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author John.zhang
 * @version Id: SeckillOrderController, v 1.0 2021/1/8 11:01 ZhiYong Exp $
 */

@RestController
@RequestMapping(value = "/seckill/activity")
public class SeckillActivityController {

    @Resource
    private SeckillActivityService seckillActivityService;

    /**
     * 有效活动列表
     */
    @GetMapping
    public RespResult list() {
        //查询活动列表
        List<SeckillActivity> seckillActivities = seckillActivityService.validActivity();
        return RespResult.ok(seckillActivities);
    }

}
